import { v4 as uuidv4 } from 'uuid';
import * as md5 from 'md5';
import { Seeder } from '../../umzug';

const seedManagers = [{
  id: 1,
  uuid: uuidv4(),
  name: 'lucy',
  password: md5('7654321'),
  age: 36,
  created_at: new Date(),
  updated_at: new Date(),
}];

export const up: Seeder = async ({ context: sequelize }) => {
  await sequelize.getQueryInterface().bulkInsert('managers', seedManagers);
};

export const down: Seeder = async ({ context: sequelize }) => {
  await sequelize
    .getQueryInterface()
    .bulkDelete(
      'managers',
      { id: seedManagers.map((u) => u.id) }
    );
};
